import { Component, OnInit } from "@angular/core";
import { StoreService } from "../store.service";
import { DataService } from "../data.service";
import { VisualService } from "../visual.service";

@Component({
  selector: "app-mridview",
  templateUrl: "./mridview.component.html",
  styleUrls: ["./mridview.component.less"],
})
export class MridviewComponent implements OnInit {
  constructor(
    public storeService: StoreService,
    public dataService: DataService,
    public visualService: VisualService
  ) {}
  queryMRID: string = "";
  ngOnInit() {}
  async searchmrid() {
    let r = await this.dataService.queryMrid("mr/", this.queryMRID, 1, 100);

    let ro = JSON.parse(r as string);

    this.results = ro["body"]["results"];
  }

  public results: any[] = [];

  drawLine() {
    this.visualService.drawFishbone("svg", this.results, false);
    // this.visualService.drawSpineLine("svg");
    // this.visualService.drawRibLine("svg", 50, 150);
    // this.visualService.drawRibLine("svg", 150, 150);
    // this.visualService.drawRibLine("svg", 50, -150);
    // this.visualService.drawRibLine("svg", 150, -150);
    // this.visualService.drawRibText("svg", 50, 150, "xxxxxxxxxxxxxxxxxxx");
    // this.visualService.drawRibText("svg", 150, 150, "xxxxxxxxxxxxxxxxxxx");
    // this.visualService.drawRibText("svg", 50, -150, "xxxxxxxxxxxxxxxxxxx");
    // this.visualService.drawRibText("svg", 150, -150, "xxxxxxxxxxxxxxxxxxx");
    // this.visualService.drawStartPoint("svg");
    // this.visualService.drawEndPoint("svg");
  }

  drawExpandLine() {
    this.visualService.drawFishbone("svg", this.results, true);
  }
}
